package com.pth.admin.action;

import com.opensymphony.xwork2.ActionSupport;
import com.pth.model.News;
import com.pth.service.NewsService;
import com.pth.utils.timeUtil;

@SuppressWarnings("serial")
public class NewsAllAction extends ActionSupport {

	private int id;
	
	private NewsService newsService;
	
	private News news;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public NewsService getNewsService() {
		return newsService;
	}

	public void setNewsService(NewsService newsService) {
		this.newsService = newsService;
	}

	public News getNews() {
		return news;
	}

	public void setNews(News news) {
		this.news = news;
	}
	
	
	public String delete() throws Exception{
		
		News n=newsService.getNewsByid(id);
		
		newsService.delete(n);
		
		return "delete";
		
	}
	
	
	public String modify() throws Exception{
		
		news.setNewspublishtime(timeUtil.getCurrentDate());
		
		newsService.modify(news);
		
		return "modify";
	}
	
	
}
